﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

namespace DataLayer
{
    public class dllogin
    {

        public DataSet LoginCheck(string username, string password)
        {


            string connStr = ConfigurationManager.ConnectionStrings["constring"].ConnectionString;
            string querystring = @"select all UserID, RoleId, Roles.Role, Login, Passwoord, Name, Firstname from Users inner join Roles on users.roleid = roles.rolesID where ((Login = '" + username + "') AND (Passwoord = '" + password + "'))";

            SqlConnection connection = new SqlConnection(connStr);
            SqlCommand querylogin = new SqlCommand(querystring, connection);

            SqlDataAdapter myadapter = new SqlDataAdapter(querylogin);
            DataSet mydataset = new DataSet();

            myadapter.Fill(mydataset);

            return mydataset;
        }

    }
}
